package me.spring.cloud.common.components.util.enums;

import me.spring.cloud.common.components.util.enums.inter.EnumLeab;
import me.spring.cloud.common.components.util.enums.inter.RegularEnum;
import java.util.regex.Pattern;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @description: 电话号码:手机or固话
 * @author: luffy
 * @create: 2018-07-20 16:29
 **/
@Getter
@AllArgsConstructor
public enum TelPhoneEnum implements RegularEnum<String>, EnumLeab<String> {
  CHINSE_MOBILE_PHONE("^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\\d{8}$", "中国手机号码"),
  CHINSE_LANDLINE_PHONE("^\\(?(\\d{3,4})\\)?\\-?\\d{7,8}$", "中国固话");
  private String regular;
  private String leab;

  public boolean matches(String string) {
    Pattern pattern = Pattern.compile(this.regular);
    return pattern.matcher(string).matches();
  }
}
